﻿<local:DocumentBase x:Class="WPFExcelReport.REFMOV"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:ReflectionStudio.Components.UserControls;assembly=ReflectionStudio.Core"
                    xmlns:db="clr-namespace:ReflectionStudio.Core.Database;assembly=ReflectionStudio.Core"
                    xmlns:fd="clr-namespace:Labs.Filtering;assembly=ReflectionStudio.Core"
                    xmlns:wep="clr-namespace:WPFExcelReport"
                      
                    xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"
                    Loaded="Window_Loaded"
                    Title="后整状态"  
                    HorizontalAlignment="Stretch"  Margin="0,0,0,0"  VerticalAlignment="Stretch" >
    <local:DocumentBase.Resources>
        <Style x:Key="GroupHeaderStyle" TargetType="{x:Type GroupItem}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type GroupItem}">
                        <Expander x:Name="exp" IsExpanded="True"
                          Background="White"
                          Foreground="Black">
                            <Expander.Header>
                                <StackPanel Orientation="Horizontal">
                                    <TextBlock Text="{Binding Path=ARTICLE}" />
                                    <TextBlock Text="{Binding Path=ItemCount}"/>
                                    <TextBlock Text="Items"/>
                                </StackPanel>
                            </Expander.Header>
                            <ItemsPresenter />
                        </Expander>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <db:INTEXDataSet x:Key="iNTEXDataSet" />
        <CollectionViewSource  x:Key="FlickrGroupedFeed" Source="{Binding Path=WBBEW,Source={StaticResource iNTEXDataSet}}">
        </CollectionViewSource>
    </local:DocumentBase.Resources>
    <Grid DataContext=""  HorizontalAlignment="Stretch"  Margin="10,10,0,0"  VerticalAlignment="Stretch">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <WrapPanel Name="zoneCommand" Height="34" Margin="0,0,0,6">
            <Button  Content="查询"  Height="23" Margin="10,0,0,0"  Name="btnQuery" Width="75" Click="btnQuery_Click" />
            <Button Content="仅生成报表" Margin="10,0,0,0"   Height="23"   Name="btnReport" Width="75" Click="btnReport_Click" />
            <Button Content="打印报表" Margin="10,0,0,0"  Height="23" Name="btnPrint" Width="90" Click="btnPrint_Click"/>
            <Button Content="浏览数据"  Margin="10,0,0,0"  Height="23"  Name="btnPrintPreview" Width="90" Click="btnPrintPreview_Click"/>
        </WrapPanel>
        <StackPanel Grid.Row="1">
            <WrapPanel >
                <Label Content="开始日期"    Width="80" Margin="10,0,0,0"  HorizontalAlignment="Left"   FontSize="18" VerticalAlignment="Center" Foreground="#FF241616" />
                <TextBox Name="txtBYEAR" Width="50" Margin="10,0,0,0"  HorizontalAlignment="Left" Background="Pink" FontSize="18" Text="2011" Foreground="#FF241616" />
                <Label Content="年"    Width="20" Margin="10,0,0,0" HorizontalAlignment="Left"   FontSize="18" VerticalAlignment="Center" Foreground="#FF241616" />
                <TextBox Name="txtBMONTH" Width="30" Margin="10,0,0,0"  HorizontalAlignment="Left" Background="Beige" Text="05" FontSize="18" Height="30" Foreground="#FF241616" />
                <Label Content="月"    Width="20" Margin="10,0,0,0" HorizontalAlignment="Left"    FontSize="18" VerticalAlignment="Center" Foreground="#FF241616" />
                <TextBox Name="txtBDAY" Width="30" Margin="10,0,0,0"  HorizontalAlignment="Left" Background="YellowGreen" FontSize="18" Text="01" Height="30" Foreground="#FF241616" />
                <Label Content="日"    Width="20" Margin="10,0,0,0" HorizontalAlignment="Left"    FontSize="18" VerticalAlignment="Center" />
            </WrapPanel>
            <WrapPanel >
                <Label Content="结束日期"    Width="80" Margin="10,0,0,0"  HorizontalAlignment="Left"   FontSize="18" VerticalAlignment="Center" Foreground="#FF241616" />
                <TextBox Name="txtEYEAR" Width="50" Margin="10,0,0,0"  HorizontalAlignment="Left" Background="Pink" FontSize="18" Text="2011" Foreground="#FF241616" />
                <Label Content="年"    Width="20" Margin="10,0,0,0" HorizontalAlignment="Left"   FontSize="18" VerticalAlignment="Center" Foreground="#FF241616" />
                <TextBox Name="txtEMONTH" Width="30" Margin="10,0,0,0"  HorizontalAlignment="Left" Background="Beige" Text="05" FontSize="18" Height="30" Foreground="#FF241616" />
                <Label Content="月"    Width="20" Margin="10,0,0,0" HorizontalAlignment="Left"    FontSize="18" VerticalAlignment="Center" Foreground="#FF241616" />
                <TextBox Name="txtEDAY" Width="30" Margin="10,0,0,0"  HorizontalAlignment="Left" Background="YellowGreen" FontSize="18" Text="01" Height="30" Foreground="#FF241616" />
                <Label Content="日"    Width="20" Margin="10,0,0,0" HorizontalAlignment="Left"    FontSize="18" VerticalAlignment="Center" />
            </WrapPanel>
        </StackPanel>
        <WrapPanel Grid.Row="2" Width="Auto">
            <fd:FilteringDataGrid 
            AutoGenerateColumns="False" EnableRowVirtualization="True"  
                                               ItemsSource="{Binding}"  
                                            HeadersVisibility="Column"
                                              x:Name="SUMDataGrid" 
                                                 CanUserReorderColumns="True"  
                                             CanUserResizeRows="True"
                                              CanUserSortColumns="True"
                                              IsFilteringCaseSensitive="False" 
                                              RowDetailsVisibilityMode="VisibleWhenSelected"   
                                              Width="370"
                                              Height="500"
                                              EnableColumnVirtualization="True"  
                                              ScrollViewer.HorizontalScrollBarVisibility="Auto"
                                              ScrollViewer.VerticalScrollBarVisibility="Auto"
                                              SelectionChanged="SUMDataGrid_SelectionChanged"
                                              >
                <DataGrid.Columns>
                    <!--ARTICLE,WBEWBESCHICH,WBEWBUCHDAT,WBEWBS,WBBDPART,  PCNUM,WBEWLO,WBEWLB,  WBEWMTR STARTQTY, ENDQTY, 
                        STARTPCNUM,0 as ENDPCNUM-->
                    <DataGridTextColumn Binding="{Binding Path=FACTORY}" Header="客户名称"  MinWidth="70"/>
                    <DataGridTextColumn Binding="{Binding Path=ARTICLE}" Header="品种" Width="SizeToHeader"  MinWidth="70"/>
                    <DataGridTextColumn Binding="{Binding Path=WBEWBESCHICH}" Header="后整/套色"  Width="50"/>
                    <DataGridTextColumn Binding="{Binding Path=COLORDES}" Header="描述" Width="SizeToHeader" MinWidth="80"/>
                    <DataGridTextColumn Binding="{Binding Path=WBBDPART}" Header="缸号" Width="SizeToHeader" MinWidth="60"/>
                    <DataGridTextColumn Binding="{Binding Path=WBEWMTR}" Header="数量(码)"   FontSize="12" Foreground ="Red"  MinWidth="50"/>
                    <DataGridTextColumn Binding="{Binding Path=PCNUM}" Header="匹数"  FontSize="12" Foreground="Red" Width="SizeToHeader" MinWidth="20"/>
                </DataGrid.Columns>
            </fd:FilteringDataGrid>
            <fd:FilteringDataGrid               
            AutoGenerateColumns="False" EnableRowVirtualization="True"  
                                                ItemsSource="{Binding}" 
                                            HeadersVisibility="Column"
                                              x:Name="MasterDg" 
                                                 CanUserReorderColumns="True"  
                                             CanUserResizeRows="True"
                                              CanUserSortColumns="True"
                                              IsFilteringCaseSensitive="False" 
                                              RowDetailsVisibilityMode="VisibleWhenSelected"   
                                              Width="550"
                                              Height="500"
                                              EnableColumnVirtualization="True"  
                                              ScrollViewer.HorizontalScrollBarVisibility="Auto"
                                              ScrollViewer.VerticalScrollBarVisibility="Auto"
                                              SelectionChanged="ItemsControls_SelectionChanged"
                                              >
                <DataGrid.Columns>
                    <!--ARTICLE,WBEWBESCHICH,WBEWBUCHDAT,WBEWBS,WBBDPART,  PCNUM,WBEWLO,WBEWLB,  WBEWMTR STARTQTY, ENDQTY, 
                        STARTPCNUM,0 as ENDPCNUM-->
                    <DataGridTextColumn Binding="{Binding Path=WBEWBUCHDAT}" Header="日期" Width="SizeToCells" MinWidth="40" />
                    <DataGridTextColumn Binding="{Binding Path=WBEWBUCHUHR}" Header="时间" Width="SizeToCells" MinWidth="30" />
                    <DataGridTextColumn Binding="{Binding Path=TYPE}" Header="类型" Width="SizeToCells" MinWidth="30" />
                    <DataGridTextColumn Binding="{Binding Path=FACTORY}" Header="客户名称"  MinWidth="70"/>
                    <DataGridTextColumn Binding="{Binding Path=ARTICLE}" Header="品种" Width="SizeToHeader"  MinWidth="70"/>
                    <DataGridTextColumn Binding="{Binding Path=WBEWBESCHICH}" Header="后整/套色"  MinWidth="50"/>
                    <DataGridTextColumn Binding="{Binding Path=COLORDES}" Header="描述" Width="SizeToHeader" MinWidth="80"/>
                    <DataGridTextColumn Binding="{Binding Path=WBBDPART}" Header="缸号" Width="SizeToHeader" MinWidth="70"/>
                    <DataGridTextColumn Binding="{Binding Path=WBEWBS}" Header="BS" Width="SizeToCells" MinWidth="40" />
                    <DataGridTextColumn Binding="{Binding Path=WBEWMTR}" Header="数量(码)"   FontSize="12" Foreground ="Red"  MinWidth="50"/>
                    <DataGridTextColumn Binding="{Binding Path=PCNUM}" Header="匹数"  FontSize="12" Foreground="Red" Width="SizeToHeader" MinWidth="20"/>
                </DataGrid.Columns>
            </fd:FilteringDataGrid>
        </WrapPanel>
    </Grid>
</local:DocumentBase>
